SET NOCOUNT ON
USE Northgale
go
ALTER DATABASE Northgale SET COMPATIBILITY_LEVEL = 170
ALTER DATABASE SCOPED CONFIGURATION SET OPTIONAL_PARAMETER_OPTIMIZATION = ON
go
CREATE OR ALTER PROCEDURE static_search_simple
                          @orderid int      = NULL,
                          @custid  nchar(5) = NULL,
                          @date    date     = NULL AS
   SELECT *
   FROM   Orders
   WHERE  (OrderID    = @orderid OR @orderid IS NULL)
     AND  (CustomerID = @custid OR @custid IS NULL)
     AND  (OrderDate  = @date   OR @date IS NULL)
go
EXEC static_search_simple 
EXEC static_search_simple @orderid = 11000
EXEC static_search_simple @custid  = N'VINET'
EXEC static_search_simple @date    = '19970217'






    